package com.test.hhf.think_enum;

/**
 * @author: Dean
 * @create: 2019-03-13 15:58
 **/
public enum CompanyEnum {
    NING_BO(0,"宁波观复文化有限公司"),
    XIAO_GUAN(1,"小观文创"),
    EMPTY_COMPANY(-1,"空壳公司");

    private final int companyCode;
    private final String companyDesc;

    CompanyEnum(int companyCode, String companyDesc) {
        this.companyCode = companyCode;
        this.companyDesc = companyDesc;
    }

    public int codeOfCompany(){
        return companyCode;
    }

    public String codeOfCompanyDesc(){
        return companyDesc;
    }

    public static CompanyEnum companyOfCode(int companyCode){
        CompanyEnum[] values = CompanyEnum.values();
        for (CompanyEnum cenum : values) {
            if (companyCode == cenum.companyCode){
                return cenum;
            }
        }
        return CompanyEnum.EMPTY_COMPANY;
    }
}
